﻿using System;
using System.Collections;
using System.Collections.Generic;
using Pap.Data;
using Pap.Web.Utils;

namespace Pap.Web.Modules.Reports.ViewModel
{
    /// <summary>
    /// 
    /// </summary>
    public class StatisticsReportViewModel : IViewModel
    {
        /// <summary>
        /// 
        /// </summary>
        IReportRepository _ReportRepository;

        /// <summary>
        /// Initializes a new instance of the <see cref="StatisticsReportViewModel"/> class.
        /// </summary>
        /// <param name="repo">The repo.</param>
        public StatisticsReportViewModel(IReportRepository repo)
        {
            _ReportRepository = repo;
        }

        /// <summary>
        /// Gets all projects.
        /// </summary>
        /// <returns></returns>
        public IEnumerable<IProject> GetAllProjects()
        {
            return _ReportRepository.FindProjects(project => true);
        }

        /// <summary>
        /// Gets the male percent.
        /// </summary>
        /// <param name="projectID">The project ID.</param>
        /// <param name="dateTime">The date time.</param>
        /// <returns></returns>
        public double GetMalePercent(Guid projectID, DateTime dateTime)
        {
            return _ReportRepository.GetMalePercent(projectID, dateTime);
        }

        /// <summary>
        /// Gets the male activity.
        /// </summary>
        /// <param name="projectID">The project ID.</param>
        /// <param name="dateTime">The date time.</param>
        /// <returns></returns>
        public IEnumerable GetMaleActivity(Guid projectID, DateTime dateTime)
        {
            return _ReportRepository.GetMaleActivity(projectID, dateTime);
        }

        /// <summary>
        /// Gets the acitivty percents.
        /// </summary>
        /// <param name="projectID">The project ID.</param>
        /// <param name="dateTime">The date time.</param>
        /// <returns></returns>
        public IEnumerable GetAcitivtyPercents(Guid projectID, DateTime dateTime)
        {
            return _ReportRepository.GetActivityPercents(projectID, dateTime);
        }

        /// <summary>
        /// Gets the existing loans.
        /// </summary>
        /// <param name="projectID">The project ID.</param>
        /// <param name="dateTime">The date time.</param>
        /// <returns></returns>
        public double GetExistingLoans(Guid projectID, DateTime dateTime)
        {
            return _ReportRepository.GetExisitingLoansPercent(projectID, dateTime);
        }

        /// <summary>
        /// Gets the loan count.
        /// </summary>
        /// <param name="projectID">The project ID.</param>
        /// <param name="dateTime">The date time.</param>
        /// <returns></returns>
        public double GetLoanCount(Guid projectID, DateTime dateTime)
        {
            return _ReportRepository.GetLoanCount(projectID, dateTime);
        }
    }
}
